package twiddles.littleprincess.common;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.springframework.stereotype.Component;

@Component
public class EMF {
	private static final EntityManagerFactory emfInstance =
		Persistence.createEntityManagerFactory("transactions-optional");
	
	private EMF() {}
	
	public EntityManager entityManager() {
		return emfInstance.createEntityManager();
	}
	
	public EntityManagerFactory entityManagerFactory() {
		return emfInstance;
	}
}
